package com.bwie.redkids;

import java.util.ArrayList;

import com.bwie.redkids.adapter.CollectListBaseAdapter;
import com.bwie.redkids.adapter.ShoppingListBaseAdapter;
import com.bwie.redkids.bean.Favorites;
import com.bwie.redkids.utils.FavoriteDBUtils;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;

public class CollectionActivity extends Activity implements OnClickListener {

	private ListView lv_collect_list;
	private FavoriteDBUtils favoriteDBUtils = new FavoriteDBUtils();
	private Button collect_back;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_collection);
		initView();
		ArrayList<Favorites> query = favoriteDBUtils.query();
		lv_collect_list.setAdapter(new CollectListBaseAdapter(
				CollectionActivity.this, query));
	}

	private void initView() {
		lv_collect_list = (ListView) findViewById(R.id.lv_collect_list);
		collect_back = (Button) findViewById(R.id.collect_back);
		favoriteDBUtils.openSQLite(this);
		collect_back.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.collect_back:
			CollectionActivity.this.finish();
			break;

		default:
			break;
		}
	}

}
